
#ifndef _CUDA_BINDINGS_
#define _CUDA_BINDINGS_

#include <vector>
#include <ttg_ext/cuda_bindings.h>
#include "Sphere.h"

using namespace ttg_ext::bindings;

//Binding to CUDA technology.
class cudaIntersectionFinder :public cudaBinding<std::vector<Sphere> *,
												 std::vector<float> >
{
	private:
		//Kernel method, that will be compiled by nvcc compiler.
		void processKernel(Sphere *spheres, float *depths, size_t count);
	public:
		//Version of process for CUDA.
		virtual void process(std::vector<Sphere> *data)
		{
			try
			{
				std::vector<float> res(data->size(), 0.0f);
				processKernel(&(*data)[0], &res[0], data->size());
				sendNext(res);
			}
			catch (ttg::Error &err)
			{ printf("CUDA Error: %s\n", err.toString()); }
		}
};

#endif
